<?php

class Default_UploadController extends Ac_Controller_Action
{
    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

    public function profilePicAction()
    {
        try {
            $res = Ac_Util::uploadProfilePhoto();
            $image = $this->view->thumbnail()->scale($res, 110, 90);
            $this->_helper->json((object) array('result' => 1, 'url' => $image, 'ori' => $res));
        } catch (Exception $e) {
            $this->_helper->json((object) array('result' => 0));
        }
    }


    public function companyPicAction()
    {
        try {
            $res = Ac_Util::uploadProfilePhoto();
            $image = $this->view->thumbnail()->scale($res, 280, 280);
            $this->_helper->json((object) array('result' => 1, 'url' => $image, 'ori' => $res));
        } catch (Exception $e) {
            $this->_helper->json((object) array('result' => 0));
        }
    }

    public function listingPhotoAction()
    {
        return Ac_Util::uploadListingPhotoProcess();
    }
    
    public function companyPhotoAction()
    {
        return Ac_Util::uploadCompanyPhotoProcess();
    }
}

